
<!doctype html>
<html>

<head>
    <script type="text/javascript">
        window.__trace__headstart = +new Date;
        window.__server__startTime = 1471567425065 || +new Date;
    </script>
    <meta charset="UTF-8"/>

    <meta http-equiv="Cache-Control" content="no-transform " />
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>美丽说 - 收货地址</title>
    <meta name="keywords" content="蘑菇街,mogujie,买手,买手街,网购"/>
    <meta name="description" content="蘑菇街-中国最大的女性电子商务平台，精选款式美、质量优、价格合理的衣服、鞋子、箱包、配饰和美妆等潮流商品。让8000万女性会员在这里享受购物乐趣，发现时尚精品，分享消费体验。"/>
    <meta name="copyright" content="meilishuo.com"/>

    <meta name="apple-itunes-app"
          content="app-id=452176796, app-argument="/>
    <meta name="og:title" content=""/>
    <meta name="og:description" content="蘑菇街-中国最大的女性电子商务平台，精选款式美、质量优、价格合理的衣服、鞋子、箱包、配饰和美妆等潮流商品。让8000万女性会员在这里享受购物乐趣，发现时尚精品，分享消费体验。"/>
    <meta name="og:image" content=""/>
    <meta name="og:image:width" content=""/>
    <meta name="og:image:height" content=""/>

    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml"/>
    <link rel="icon" href="pic/_o/46/c2/7545d5f20d276e84af0f034b0287_92_94.cf.png" type="image/x-icon"/>

    <script> curl = {apiName: 'require'}; var MOGU = {}; </script>

    <!-- 卡点 --><link rel="stylesheet" type="text/css" href="css/header.css$ead98e0e_1471519499.css" media="all" /><link rel="stylesheet" type="text/css" href="css/page-muorder-common.css$ead98e0e_1471519499.css" media="all" />
   <!--  <script type="text/javascript" src="js/pkg-pc-base.js$ead98e0e_1471519499.js"></script> --> 
    <script>PTP_PARAMS={"real_url":"http:\/\/log.juangua.com\/mogu.js?sfrom=logistics.meilishuo.com%255E&uid=11cnkktq&method=GET&time=1471567425&uuid=e320d57a-fde9-4936-99c2-27ee528b7657&ptp_url=&ptp_ref=&c_action=trade_address%2540%2540index&ptp_cnt=1.BpL5fyWj&custom_event=","cps_info":"","refer":"%2Ftrade%2Faddress%3F_uk%3D931d1543c436ae2fd00a6d5edef1cd6168f21a64","rerefer":"http%3A%2F%2Flogistics.meilishuo.com%2Ftrade%2Faddress%3F_uk%3D931d1543c436ae2fd00a6d5edef1cd6168f21a64","ptp_cnt_a":"1","ptp_cnt_b":"BpL5fyWj","c_action":"trade_address%40%40index","time":"1471567425"};__MgjCinfoOn=1;</script>
    <script type="text/javascript">
        var MOGU_DEV=0;        if(window.require) {
            require.config({
                domain: 'https://s10.mogucdn.com'
            });
        }


        MOGUPROFILE = {cdnHost:"//s17.mogucdn.com",appEnv:"production",is_subsite:"0",push_serviceHost:"221.228.199.44:117.121.133.45:8008",push_ajaxServiceHost:"http://m2.mogujie.com:8080",push_ajaxSericeBakHost:"http://117.121.133.50:8080",push_token:"4039a95a9d5bd008bf54b27300d67467",isNewIMShow:"true",google_ecomm_pagetype:"other",google_ecomm_pcat:"",userid:"11cnkktq",avatar:"http://s2.mogucdn.com/new1/v1/bdefaultavatar/03.jpg",isBuyer:"false"};

        //性能打点数据检测
        window.__trace__headendt = +new Date;
        (function(){
            window.__trace__domready = null;
            window.__trace__ladingendt = null;
            if(document.readyState){
                function setDomOperation(){
                    if(document.readyState == 'interactive'){
                        window.__trace__domready = +new Date();
                    }
                    else if(document.readyState == 'complete'){
                        window.__trace__ladingendt = +new Date();
                    }
                }
                setDomOperation();
                document.onreadystatechange = setDomOperation;
            }
        })();
    </script>
</head>
<body>
<!-- <script type="text/javascript">
    /**
     ** for layout 960
     **/
    (function(){
        var wWidth = $(window).width(); if(wWidth < 1212){ $('body').addClass('media_screen_960'); } else { $('body').addClass('media_screen_1200'); }
        //initTime for log 判断对象是否存在
        window.MoGu && $.isFunction(MoGu.set) && MoGu.set('initTime', (new Date()).getTime());

        var ua = navigator.userAgent;
        // 判断是否是ipad
        var is_plat_ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
        if(is_plat_ipad) {
            $('body').addClass('media_ipad');
        }
        // 判断是否是ipadApp
        var is_plat_ipadApp = ua.indexOf('MogujieHD') >= 0 || ua.indexOf('Mogujie4iPad') >= 0 || location.href.indexOf('_atype=ipad') >= 0;
        if(is_plat_ipadApp) {
            $('body').addClass('media_ipad_app');
            // 隐藏头尾
            $('body').append('<style type="text/css">.header_2015,.header_nav,.foot .foot_wrap{display: none;}.foot{height: 0;background: none;}.back2top_wrap{height:0;width:0;overflow:hidden;opacity:0;}</style>');
            // 移除购物车，返回顶部
            setTimeout(function(){
                $('.back2top_wrap').remove();
            },1000)
        }
    })();
</script> -->

<div id="header" class="J_sitenav header_2015" data-ptp="_head">
    <div class="wrap clearfix">
        <!-- 顶通 -->
        <a href="index.html" class="home fl">美丽说首页</a>
        <ul class="header_top">
            <li class="s1 has_icon user_meta">
                <a rel="nofollow" href="javascript:;">
                    阿猫来了                    </a>
                <i class="icon_delta"></i>
                <ol class="ext_mode" id="menu_personal">
                    <li class="s2"><a target="_blank" rel="nofollow" href="=setPersonal.html">个人设置</a></li>
                    <li class="s2"><a rel="nofollow" href="#">退出</a></li>
                </ol>
            </li>

            <li class="s1 has_icon has_line user_fav ">
                <a rel="nofollow" href="javascript:;">我的收藏</a>
                <i class="icon_delta"></i>
                <ul class="ext_mode">
                    <li class="s2"><a target="_blank" rel="nofollow" href="mylike.html">收藏的商品</a></li>
                    <li class="s2"><a target="_blank" rel="nofollow" href="mylikestore.html">收藏的小店</a></li>
                    <li class="s2"><a target="_blank" rel="nofollow" href="footprint.html">浏览足迹</a></li>
                </ul>
            </li>


            <li class="s1 myorder has_line">
                <a href="orderlist.html" target="_blank" class="text display_u" ref="nofollow">我的订单</a>
            </li>

            <li class="s1 has_line has_icon ">
                <a href="#" ref="nofollow" target="_blank" class="text display_u">商家后台</a>
            </li>
        </ul>
    </div>
</div>
<!-- 中间区域 -->
<div class="g-header clearfix">
    <div class="g-header-in wrap clearfix">
        <div class="logo logo-cart"></div>
    </div>
</div>

<style type="text/css">
    #body{width:960px;margin: 0 auto;}
    #body .mu_wrap{margin-top:30px;}
    #body .mu_content_wrap, #body .complain_right, #body .addr_right{width: 100%;}
</style>
<div id="app">
<div id="body">
    <div class="mu_wrap clearfix">
        <div class="mu_nav_wrap">
            <!-- 导航 -->
        </div>
        <div class="mu_content_wrap">
            <div class="addr_right topay" isaddress='true' topaycount="">
                <h2 class="addr_title">地址管理</h2>
                <div class="addr_edit" id="J_s_addr_edit">
                    <div class="add_new_addr clearfix"><span id="addaddr" onclick="address()">+添加地址</span></div>
                    <div class="addressbox_warp">
                        <div class="addressbox" id="J_sAddrWrap"></div>
                        <!-- <div class="addressbox addressfirst addresslist" action="/trade/address/addfororder">
                        </div> -->
                 <div class="__addressPop">
			        <dl class="address_pop" style="display:none" id="addAddress">
			        <input type="hidden" class="J_addressid" name="addressId" >
			            <dt>省：</dt>
			            <dd class="pt_ie6hack"><i class="needicon">*</i><input class="text formsize_normal J_postcode J_form vm" v-model="province">
			                </select><label class="dt" for="">市：</label><input class="text formsize_normal J_postcode J_form vm" v-model="city">
			                </select><label class="dt" for="">区：</label><input class="text formsize_normal J_postcode J_form vm" v-model="area">
			                </select><span class="prompt"></span></dd>
			            <dt>邮政编码：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="c" data-errormsg="请填写正确的邮政编码" data-normal=""
			                    class="text formsize_normal J_postcode J_form vm" name="postcode" v-model="postal"><span class="prompt"></span></dd>
			            <dt>街道地址：</dt>
			            <dd><i class="needicon">*</i><textarea data-type="*" data-min="5" data-max="100"
			                    data-normal="请填写街道地址，最少5个字，最多不能超过100个字" data-errormsg="请填写街道地址，最少5个字，最多不能超过100个字"
			                    class="textarea formsize_large J_street J_form" name="street" cols="30" rows="3" v-model="street"></textarea><span
			                    class="prompt breakline">请填写街道地址，最少5个字，最多不能超过100个字</span></dd>
			            <dt>收货人姓名：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="*" data-errormsg="请填写收货人" data-normal=""
			                    class="text formsize_normal J_name J_form vm" name="name" v-model="aname"><span class="prompt" ></span></dd>
			            <dt>手机：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="phone" data-errormsg="请填写正确的联系号码" data-normal=""
			                    class="text formsize_normal J_mobile J_form vm" name="mobile" v-model="tel"><span class="prompt" ></span></dd>
			            <dt></dt>
			            <dd class="pt10 oper_btn"><a href="javascript:;" class="confirm_btn J_okbtn mr10" @click="addAddress()">确认地址</a><a
			                    href="javascript:;" class="cancel_btn J_cancelbtn" onclick="returned()">取消</a></dd> <!-- onclick必须加(),@click在不传值的情况下可以不加 -->
			        </dl>
    			</div>
    			 <div class="__addressPop">
			        <dl class="address_pop" style="display:none" id="updateAddress">
			        <input type="hidden" class="J_addressid" name="addressId" >
			            <dt>省：</dt>
			            <dd class="pt_ie6hack"><i class="needicon">*</i><input class="text formsize_normal J_postcode J_form vm" v-model="province2">
			                </select><label class="dt" for="">市：</label><input class="text formsize_normal J_postcode J_form vm" v-model="city2">
			                </select><label class="dt" for="">区：</label><input class="text formsize_normal J_postcode J_form vm" v-model="area2">
			                </select><span class="prompt"></span></dd>
			            <dt>邮政编码：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="c" data-errormsg="请填写正确的邮政编码" data-normal=""
			                    class="text formsize_normal J_postcode J_form vm" name="postcode" v-model="postal2"><span class="prompt"></span></dd>
			            <dt>街道地址：</dt>
			            <dd><i class="needicon">*</i><textarea data-type="*" data-min="5" data-max="100"
			                    data-normal="请填写街道地址，最少5个字，最多不能超过100个字" data-errormsg="请填写街道地址，最少5个字，最多不能超过100个字"
			                    class="textarea formsize_large J_street J_form" name="street" cols="30" rows="3" v-model="street2"></textarea><span
			                    class="prompt breakline">请填写街道地址，最少5个字，最多不能超过100个字</span></dd>
			            <dt>收货人姓名：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="*" data-errormsg="请填写收货人" data-normal=""
			                    class="text formsize_normal J_name J_form vm" name="name" v-model="aname2"><span class="prompt" ></span></dd>
			            <dt>手机：</dt>
			            <dd><i class="needicon">*</i><input type="text" data-type="phone" data-errormsg="请填写正确的联系号码" data-normal=""
			                    class="text formsize_normal J_mobile J_form vm" name="mobile" v-model="tel2"><span class="prompt" ></span></dd>
			            <dt></dt>
			            <dd class="pt10 oper_btn"><a href="javascript:;" class="confirm_btn J_okbtn mr10" @click="updateAddress()">确认修改</a><a
			                    href="javascript:;" class="cancel_btn J_cancelbtn" onclick="returned2()">取消</a></dd> <!-- onclick必须加(),@click在不传值的情况下可以不加 -->
			        </dl>
    			</div>
                    </div>
                    <div id="show">                    
                    <div class="addr_section " aid="2117639690" v-for="(item,index) in list" > <!-- default -->
                        <ul class="clearfix">
                            <li class="name">{{item.aname}}</li>
                            <li class="addr"
                                data-province="item.province"
                                data-city="item.city"
                                data-area="item.area"
                                data-street="item.street">
                                {{item.province+item.city+item.area+item.street}}                </li>
                            <li class="zcode">{{item.postal}}</li>
                            <li class="zcode" style="padding: 0 50px 0 50px">{{item.astatus >= 1 ? "默认地址" : "非默认地址"}}</li>
                            <li class="mobile">{{item.tel}}</li>
                            <li class="oper">
                                <a href="javascript:;" class="J_default" @click="adddefault(index,item.aid)">默认地址</a>
                                <a href="javascript:;" class="edit" onclick="update()" @click="show(index,item.aid)">编辑</a>
                                <a href="javascript:;" class="del nobd" @click="deleteAddr(item.aid)">删除</a>
                            </li>
                            <li class="enaddr"></li>
                        </ul>
                    </div>
                    </div>
                    
                </div>
            </div>

        </div>
    </div>
    <input type="hidden" value="mls" id="sourceForm">
</div>
</div>
<div class="foot J_footertimer" data-ptp="_foot" data-svrtime="$!service_time">
    <div class="wrap foot_wrap clearfix">
        <div class="foot_info" style="width:290px">
            <a rel="nofollow" class="info_logo" href="index.html"></a>
            <div class="info_text">
                <p>营业执照注册号：<a rel="nofollow" href="http://s6.mogucdn.com/pic/140924/8qc9_ieydgn3emqztszbxmmytambqmmyde_1502x2246.jpg" target="_blank">110108013011072</a></p>
                <p>京ICP备11031139号</p>
                <p>
                    <a target="_blank"  style="display:inline-block;text-decoration:none;height:20px;line-height:20px;">
                        <img  style="float:left;"><!-- 党徽 -->
                        <span style="color: #999;">&nbsp;京公网安备 110108006045</span>
                    </a>
                </p>
                <p class="mgjhostname" title="mofa130100">(c)2016 meilishuo.com 北京美丽时空网络科技有限公司</p>
            </div>
        </div>
        <div class="foot_link">
            <dl class="link_company">
                <dt>公司</dt>
                <dd><a rel="nofollow" href="aboutus.html" target="_blank">关于我们</a></dd>
                <dd><a rel="nofollow" href="#" target="_blank">招聘信息</a></dd>
                <dd><a rel="nofollow" href="contactus.html#?sl=h3" target="_blank">联系我们</a></dd>
            </dl>
            <dl class="link_consumer">
                <dt>消费者</dt>
                <dd><a rel="nofollow" href="buyerService.html#" target="_blank">新手指南</a></dd>
                <dd><a rel="nofollow" href="buyerService.html#return/" target="_blank">服务保障</a></dd>
                <dd><a rel="nofollow" href="helpCommon.html" target="_blank">消费者服务</a></dd>
            </dl>
            <dl class="link_business">
                <dt>商家</dt>
                <dd><a rel="nofollow" href="#/" target="_blank">商家入驻</a></dd>
                <dd><a rel="nofollow" href="#" target="_blank">商家推广</a></dd>
                <dd><a rel="nofollow" href="#/help#/index" target="_blank">帮助中心</a></dd>
            </dl>
        </div>
    </div>
</div>
<script type="text/javascript" src="js/page-myorder-list.js$ead98e0e_1471519499.js"></script>
<script type="text/javascript" src="js/woodpecker.0.3.0.js$a39334f1_1458802962.js"></script>
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/axios.js"></script>
<script type="text/javascript" src="js/qs.js"></script>
<script type="text/javascript">
	let app = new Vue({
		el:'#app',
		data:{
			province:null,
			city:null,
			area:null,
			postal:null,
			street:null,
			aname:null,
			tel:null,
			province2:null,
			city2:null,
			area2:null,
			postal2:null,
			street2:null,
			aname2:null,
			tel2:null,
			list:{},
			updateaid:null
		},
		methods:{
			addAddress: function(){
				if(this.province == null|| this.province == "" || this.city == null || this.city == "" || this.area == null || this.area == "" || 
						this.postal == null || this.postal == "" || this.street == null || this.street == "" || 
						this.aname == null || this.aname == "" || this.tel == null || this.tel == "" ){
					alert("请填写完整....");
					return;
				}
				if(this.street.length < 5 || this.street.length > 100){
					confirm("街道地址，最少5个字，最多不能超过100个字,请核对.....");
					return;
				}
				$.post("addr/add",{province:this.province,city:this.city,area:this.area,postal:this.postal,street:this.street,aname:this.aname,tel:this.tel},rt=>{
					if(rt.code == 200){
						alert(rt.message);
						location.reload();
						return;
					}
					if(rt.code == 512){
						alert(rt.message);
						return;
					}
					if(rt.code == 513){
						alert(rt.message);
						return;
					}
				})
			},
			adddefault: function(index,val){//html 视图层加默认地址
				$("#show .default").attr("class","addr_section");
				$("#show .addr_section").eq(index).attr("class","addr_section default");
				console.log(index,val,"adddefault");
				$.post("addr/update",{aid:val},rt=>{
					if(rt.code == 200 ){
						location.reload();
					}
					if(rt.code == 511){
						alert(rt.message);
					}
					if(rt.code == 513){
						alert(rt.message);
					}
					if(rt.code == 500){
						alert(rt.message);
					}
				})
				
			},
			deleteAddr: function(val){
				$.post("addr/deleteAddr",{aid:val},rt=>{
					if(rt.data.code == 200 ){
					}
					if(rt.data.code == 511){
						alert(rt.data.message);
					}
					if(rt.data.code == 513){
						alert(rt.data.message);
					}
					if(rt.data.code == 500){
						alert(rt.data.message);
					}
				})
			},
			show: function(index,val){
				console.log(this.list[index],"index,val");
				if(index != null || this.list[index] != null){
					this.province2 = this.list[index].province;
					this.city2 = this.list[index].city;
					this.area2 = this.list[index].area;
					this.postal2 = this.list[index].postal;
					this.street2 = this.list[index].street;
					this.aname2 = this.list[index].aname;
					this.tel2 = this.list[index].tel;
					this.updateaid = this.list[index].aid;
				}
			},
			updateAddress: function(){
				console.log(this.postal2 == null,"this.postal2");
				if(this.province2 == null|| this.province2 == "" || this.city2 == null || this.city2 == "" || this.area2 == null || this.area2 == "" || 
						this.postal2 == null || this.postal2 == "" || this.street2 == null || this.street2 == "" || 
						this.aname2 == null || this.aname2 == "" || this.tel2 == null || this.tel2 == "" ){
					alert("请填写完整....");
					return;
				}
				if(this.street2.length < 5 || this.street2.length > 100){
					confirm("街道地址，最少5个字，最多不能超过100个字,请核对.....");
					return;
				}
				if(this.updateaid == null){
					alert("这个地址信息已经不存在了...");
				}
				console.log(this.province2,this.city2,this.area2,this.postal2,this.street2,this.aname2,this.tel2,this.updateaid);
				$.post("addr/updateone",{province:this.province2,city:this.city2,area:this.area2,postal:this.postal2,street:this.street2,aname:this.aname2,tel:this.tel2,aid:this.updateaid},rt=>{
					if(rt.code == 200){
						alert(rt.message);
						location.reload();
						return;
					}
					if(rt.code == 512){
						alert(rt.message);
						return;
					}
					if(rt.code == 513){
						alert(rt.message);
						return;
					}
				})
			}
		},
		mounted(){

		},
		created(){
			axios.post("member/checklogin",null).then(rt=>{
				/**if(rt.data.code == 200){
				return;
			}
			if(rt.data.code == 511){
				confirm(rt.data.message);
				location.href="login.html";
			}**/
			})
			
			axios.post("addr/list",null).then(rt=>{
				if(rt.data.code == 200){
					this.list = rt.data.data;
					let i = this.list.length;
					for(a=0;a<i;a++){
						if(this.list[a].astatus == 1){
							//$("#show .addr_section").eq(0).attr("class","addr_section default");  暂时没有解决
							return;
						}
						
					}
					return;
				}
				if(rt.data.code == 512){
					alert(rt.data.message);
					return;
				}
				if(rt.data.code == 511){
					alert(rt.data.message);
					return;
				}
			},"json")

		}
	});
</script> 
<script type="text/javascript">
function address(){    
	$("#addAddress").css("display","block");
}
function returned(){
	$("#addAddress").css("display","none");
}
function returned2(){
	$("#updateAddress").css("display","none");
}
function update(val){
	$("#updateAddress").css("display","block");
}
</script>
</body>

</html>
